<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>、\</title>
<script src="/Content/Scripts/jquery.flexslider.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=6yAoynmTPNlTBa8z1X4LfwGE"></script>
<script type="text/javascript" src="http://developer.baidu.com/map/jsdemo/demo/convertor.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=WzdnnPRwX814CR6VcOCCEs8Vy4jkVRFf"></script>
<script>
if(navigator.geolocation){
  navigator.geolocation.getCurrentPosition(onSuccess , onError);
}else{
  alert("您的浏览器不支持使用HTML 5来获取地理位置服务");
}
//定位数据获取成功响应
function  onSuccess(position){
      alert('纬度: '          + position.coords.latitude          + '\n' +
      '经度: '         + position.coords.longitude         + '\n' +
      '海拔: '          + position.coords.altitude          + '\n' +
      '水平精度: '          + position.coords.accuracy          + '\n' +
      '垂直精度: ' + position.coords.altitudeAccura)
}
//定位数据获取失败响应
function onError(error) {
  switch(error.code)
  {
    case error.PERMISSION_DENIED:
    alert("您拒绝对获取地理位置的请求");
    break;
    case error.POSITION_UNAVAILABLE:
    alert("位置信息是不可用的");
    break;
    case error.TIMEOUT:
    alert("请求您的地理位置超时");
    break;
    case error.UNKNOWN_ERROR:
    alert("未知错误");
    break;
  }
}
</script>
<script>
window.onload=function(){
	var oInput=document.getElementById('input1');
	var oT=document.getElementById('t1');
	oInput.onclick=function(){
		navigator.geolocation.getCurrentPosition(function(position){
			oT.value='经度'+ position.coords.longtitude+'\n';
			oT.value='纬度'+ position.coords.latitude+'\n';
		});
	}
};
</script>
</head>

<body>
<input type="button" value="请求" id="input1" /><br/>
<textarea id="t1" style="width:400px;height:400px; border:1px #000 solid"></textarea>
</body>
</html>
